home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-10-24 | 35.4 KB | 728 lines | [TEXT/PJMM] |
- { Tools Plus (Version 2.1) Pascal interface }
- { Copyright (C) 1989-1993 Water’s Edge Software }
-
- { This unit is the interface between Pascal applications and Tools Plus. It must be used by any program or unit }
- { that makes reference to any part of Tools Plus. }
- { }
- { All TYPEs, VARiables, and CONSTants required by Tools Plus are included. }
- { }
- { The entire "implementation" is external, thereby requiring the use of both Tools Plus library files: }
- { "ToolsPlus.Lib1" and "ToolsPlus.Lib2" }
-
-
- unit ToolsPlus;
-
-
- interface
- const
- UseColor = true; {INITIALIZATION: Use color if available }
- IgnoreColor = false; { Don't use color }
- doNothing = 0; {POLLING: no event }
- doChgWindow = 1; { user clicked in an inactive window }
- doRefresh = 2; { a window has to be refreshed }
- doGoAway = 3; { the close box was clicked }
- doButton = 4; { button was clicked }
- doMenu = 5; { menu was selected }
- doKeyDown = 6; { a keyboard key was pressed }
- doAutoKey = 7; { a keyboard key is auto-repeating }
- doKeyUp = 8; { a keyboard key was released }
- doClickField = 9; { mouse clicked in inactive field }
- doScrollBar = 10; { mouse clicked in a scroll bar }
- doListBox = 11; { some sort of List Box activity }
- doClick = 12; { mouse click/drag }
- doClickControl = 101; { mouse clicked in a custom control }
- doManualEvent = 102; { manually processed events }
- doMoveWindow = 103; { a window was moved by user }
- doGrowWindow = 104; { a window was re-sized by the user }
- doClickDesk = 105; { mouse clicked in the desk top }
- doZoomWindow = 106; { zoom box was clicked by user }
- doSuspend = 107; { appl. suspended (in background) }
- doResume = 108; { appl. resumed (now active appl.) }
- inClick1 = 1; {CLICK: mouse single-click completed }
- inClick2 = 2; { mouse double-click completed }
- inClick3 = 3; { mouse triple-click completed }
- inClick1Drag = -1; { mouse single-click, still dragging }
- inClick2Drag = -2; { mouse double-click, still dragging }
- inClick3Drag = -3; { mouse triple-click, still dragging }
- EnterKey = char($03); {KEYS: Key characters (ASCII) for common }
- BackSpaceKey = char($08); { non apha-numeric keys. }
- TabKey = char($09); { In some cases, several keys }
- ReturnKey = char($0D); { produce the same ASCII }
- EscClearKey = char($1B); { ($1B) character. They can be }
- LeftArrowKey = char($1C); { differentiated by using the key }
- RightArrowKey = char($1D); { code, as indicated below. }
- UpArrowKey = char($1E); { Some keys are available only }
- DownArrowKey = char($1F); { on an extended keyboard. }
- HelpKey = char($05); { }
- HomeKey = char($01); { }
- DeleteFwdKey = char($7F); { }
- EndKey = char($04); { }
- PageUpKey = char($0B); { }
- PageDownKey = char($0C); { }
- FKey = char($10); { ($10) Function keys F1 to F15 }
- EscKeyCode = $35; { ($1B) KEY CODES used to differentiate }
- ClearKeyCode = $47; { ($1B) between keys which produce }
- F1KeyCode = $7A; { the same key characters. }
- F2KeyCode = $78; { }
- F3KeyCode = $63; { }
- F4KeyCode = $76; { }
- F5KeyCode = $60; { }
- F6KeyCode = $61; { }
- F7KeyCode = $62; { }
- F8KeyCode = $64; { }
- F9KeyCode = $65; { }
- F10KeyCode = $6D; { }
- F11KeyCode = $67; { }
- F12KeyCode = $6F; { }
- F13KeyCode = $69; { }
- F14KeyCode = $6B; { }
- F15KeyCode = $71; { }
- AppleChar = char($14); {MENU CHARS: Apple character }
- CheckChar = char($12); { Check Mark character }
- DiamondChar = char($13); { Diamond character }
- DotChar = char($A5); { Dot (or bullet) character }
- NoChar = char($00); { no character }
- arrowCursor = 0; {CURSORS: "arrow" cursor }
- GoAway = true; {WINDOWS: no "close box" }
- NoGoAway = false; { window has a "close box" }
- Modal = true; { window is modal }
- NotModal = false; { window is modeless }
- ZoomBox = 8; { window has a "zoom box" }
- DefaultButton = 4; {BUTTONS: “default” for the window }
- selected = true; { button is selected (i.e. checked)}
- notSelected = false; { button is not selected }
- {BUTTONS, MENUS, SCROLL BARS & ICONS: }
- enabled = true; { object is enabled }
- disabled = false; { object is disabled }
- teBoxNoCR = 0; {EDIT FIELDS: box around field, no CR allowed }
- teBoxCR = 1; { box around field, CR allowed }
- teNoBoxNoCR = 2; { no box, no CR allowed }
- teNoBoxCR = 3; { no box, CR allowed }
- teSelectAll = 0; {EDIT FIELD SELECTION: all of text }
- teSelectStart = 1; { beginning of text }
- teSelectEnd = 2; { end of text }
- teReplace = true; {PASTE INTO FIELD: replace field contents }
- teInsert = false; { insert text into field }
- OkAltBut = 1; {ALERTS: OK (Buttons refs) }
- CanAltBut = 2; { Cancel }
- YesAltBut = 3; { Yes }
- NoAltBut = 4; { No }
- ContAltBut = 5; { Continue }
- SkipAltBut = 6; { Skip }
- QuitAltBut = 7; { Quit }
- NoButtonAlert = 0; { No buttons (Alert Defs) }
- OkAlert = 11100; { OK (default) }
- CanAlert = 11200; { Cancel (default) }
- OkCanAlert = 22210; { OK (default) + Cancel }
- CanOkAlert = 21210; { OK + Cancel (default) }
- YesNoAlert = 22430; { Yes (default) + No }
- NoYesAlert = 21430; { Yes + No (default) }
- YesNoCanAlert = 33243; { Yes (default) + No + Cancel }
- NoYesCanAlert = 32243; { Yes + No (default) + Cancel }
- NoIcon = -32768; {ICONS: No icon used }
- on = true; {MISCELLANEOUS: }
- off = false; { }
- ZoomAcross = 0; {ZOOM LINES: transitional }
- ZoomIn = -1; { zoom inward (further away) }
- ZoomOut = 1; { zoom outward (nearer) }
- none = 0; {used primarily for polling }
-
-
-
-
- type
- TP_MoreMasters = 0..128; {Legal range of MoreMasters initialization cycles}
- TP_Mnums = 1..15; {Legal range of Menu numbers }
- TP_Mnums0 = 0..15; {Legal range of Menu numbers (& 0= all menus) }
- TP_MInums = 1..255; {Legal range of Menu item No.s }
- TP_MInums0 = 0..255; {Legal range of Menu item No.s (& 0= all items) }
- TP_WNums = 1..50; {Legal range of Window numbers }
- TP_BNums = 1..255; {Legal range of Button numbers }
- TP_SNums = 1..255; {Legal range of Scroll Bar numbers }
- TP_TeNums = 1..255; {Legal range of Text Editing Field numbers }
- TP_LNums = 1..255; {Legal range of List Box numbers }
- TP_LnNums = 1..32767; {Legal range of List Box line numbers }
- TP_CtNums = 1..255; {Legal range of Cursor Table numbers }
- TP_CtNums0 = 0..255; {Legal range of Cursor Table No. (& 0=no table) }
- TP_CzNums = 1..255; {Legal range of Cursor Zones in a cursor table }
- TP_AltBoxBNums = 1..9; {Legal range of Alert Box button numbers }
-
-
- { - - - - - - - - - - These record "types" are used for information transfer between - - - - - - - - - - - }
- { your application and Tools Plus libraries. }
-
- {= Polling record's "event modifiers" info}
- TPModifiersRec = packed record {This variable record contains an event's }
- case integer of { "modifiers" in 2 formats… }
- 0: ( { • Macintosh Event: }
- Num: integer { integer (bit operations required) }
- ); { }
- 1: ( { • Modifier integer parsed into components: }
- bit15, bit14, bit13: boolean; { (reserved bits) }
- ControlKey: boolean; { Control key was down at event (=1) }
- OptionKey: boolean; { Option key was down at event (=1) }
- CapsLock: boolean; { Caps Lock was down at event (=1) }
- ShiftKey: boolean; { Shift key was down at event (=1) }
- CmdKey: boolean; { Command key was down at event (=1) }
- MouseUp: boolean; { Mouse button was UP at event (=1) }
- bit6, bit5, bit4, bit3, bit2, bit1, bit0: boolean { (reserved bits) }
- ); { }
- end;
- {= Polling record's "button" info}
- TPPollButtonRec = record
- Num: integer; {Button number }
- DoubleClick: boolean {Did a double-click occur? }
- end;
- {= Polling record's "scroll bar" info}
- TPPollScrollBarRec = record
- Num: integer; {Scroll bar number }
- Part: integer {Scroll bar's part }
- end;
- {= Polling record's "list box" info}
- TPPollListBoxRec = record
- Num: integer; {List box number }
- DoubleClick: boolean {Did a double-click occur? }
- end;
- {= Polling record's "menu" info}
- TPPollMenuRec = record
- Num: integer; {Menu number }
- Item: integer {Menu item number }
- end;
- {= Polling record's "key-stroke" info}
- TPPollKeyRec = packed record
- Code: integer; {Logical key number of the typed key }
- Chr: char; {ASCII character generated by typed key }
- Unused: byte { (reserved byte) }
- end;
- {= Polling record's "mouse location and time" info for mouse-down and mouse-up events}
- TPPollMousePointRec = record
- Where: point; {Event location in local co-ordinates }
- When: longint; {Event time in clock ticks from boot (1/60 sec) }
- Modifiers: TPModifiersRec {Event modifiers }
- end;
- {= Polling record's "mouse click/drag" info}
- TPPollMouseRec = record
- What: integer; {What type of mouse event? (click or drag) }
- Down: array[1..3] of TPPollMousePointRec; {Where & when did the mouse-down occur }
- Up: array[1..3] of TPPollMousePointRec; {Where & when did the mouse-up occur }
- Where: point {Current mouse location in local co-ordinates }
- end;
- {= POLLING record for Tools Plus}
- TPPollPointer = ^TPPollRecord; {Pointer to a Polling record }
-
- TPPollRecord = record {Tools Plus Polling record… }
- What: integer; {What type of event has occurred? }
- Window: integer; {Window number of the event }
- Button: TPPollButtonRec; {Button number/double-click status }
- ScrollBar: TPPollScrollBarRec; {Scroll bar number/scroll bar part }
- Field: integer; {Field number of event }
- ListBox: TPPollListBoxRec; {List box number/double-click status }
- Menu: TPPollMenuRec; {Menu number/menu item of an event }
- Key: TPPollKeyRec; {Logical key number & character of typed key }
- Mouse: TPPollMouseRec; {Click/drag info: [1..3] where & when }
- Modifiers: TPModifiersRec; {Modifier flags }
- Event: EventRecord {Macintosh Toolbox Event (raw) }
- end;
-
- {= WINDOW status information}
- TPWindowStatus = record
- Open: boolean; {Is the window open? }
- Active: boolean; {Is this the active window? }
- Current: boolean; {Is this the current window? }
- Front: boolean; {Is this the front most Tools Plus window? }
- { (which may be inactive due to an active }
- { dialog or desk accessory under System 6) }
- Size: point; {Size in pixels (.h=horizontal, .v=vertical) }
- Where: point {Location of top-left corner in global co-ordinates}
- end;
-
- {= Color Pen information}
- ColorPenState = record {Color equivalent for a 'PenState' record. This }
- PenState: PenState; { record also stores additional values for the }
- ForegroundColor: RGBColor; { window's foreground and background }
- BackgroundColor: RGBColor { colors. }
- end;
-
-
-
-
- {==================================== I N I T I A L I Z A T I O N ==================================== }
- {Initialize Tools Plus}
- function InitToolsPlus (MoreHandles: TP_MoreMasters; {Number of MoreMasters initializing cycles }
- MaxWindows: TP_WNums; {Maximum number of windows required }
- UseColorFlag: boolean {Should Color QuickDraw be used if available? }
- ): Boolean; {Was initialization successful? }
-
-
- {======================================= W I N D O W S ======================================== }
- {Open a window and make it active}
- procedure WindowOpen (Window: TP_WNums; {Window number }
- left, top, right, bottom: Integer; {Window's co-ordinates (global) }
- Title: string; {Window's title (if applicable) }
- procID: Integer; {Window definition ID }
- goAwayFlag, modalFlag: Boolean); {Include Close Box? Is window modal? }
-
- {Open a window and make it active (co-ordinates specified as a 'rect') }
- procedure WindowOpenRect (Window: TP_WNums; {Window number }
- Bounds: rect; {Window's co-ordinates (global) }
- Title: string; {Window's title (if applicable) }
- procID: Integer; {Window definition ID }
- goAwayFlag, modalFlag: Boolean); {Include Close Box? Is window modal? }
-
- {Close a window}
- procedure WindowClose (Window: TP_WNums); {Window number }
-
- {Make a specified window the "active" and "current" window}
- procedure ActivateWindow (Window: TP_WNums); {Window number }
-
- {Set a window's title}
- procedure WindowTitle (Window: TP_WNums; {Window number }
- Title: string); {Window's title (if applicable) }
-
- {Set the current window's "dragging" boundary for the cursor}
- procedure SetCursDragBounds (left, top, right, bottom: Integer);{Cursor's "window dragging" boundary (global) }
-
- {Set the current window's "growing" limits (i.e. maximum/minimum size) }
- procedure SetWindowSizeLimits (minHoriz, minVert, maxHoriz, MaxVert: Integer);{Window's size limits in pixels}
-
- {Set the current window's standard co-ordinates and user co-ordinates for "zooming"}
- procedure SetWindowZoom (userRect, stdRect: rect); {User & standard co-ordinates (global) }
-
- {Get the current window's user co-ordinates & standard co-ordinates for "zooming"}
- procedure GetWindowZoom (var userRect, stdRect: Rect); {User & standard co-ordinates (global) }
-
- {Make a specified window "current", but do not activate it}
- procedure CurrentWindow (Window: TP_WNums); {Window number }
-
- {Make the "active" window "current"}
- procedure CurrentWindowReset;
-
- {Get a window's status}
- procedure WindowStatus (Window: TP_WNums; {Window number }
- var Status: TPWindowStatus); {Window's status record }
-
- {Get the active window number}
- function ActiveWindowNumber: integer; {Window number of active window }
-
- {Get the current window number}
- function CurrentWindowNumber: integer; {Window number of current window }
-
- {Get the front most window number}
- function FirstWindowNumber: integer; {Window number of front most window }
-
- {Get a window's "window pointer" }
- function WindowPointer (Window: TP_WNums {Window number }
- ): WindowPtr; {Window's pointer }
-
-
- {======================================== B U T T O N S ======================================== }
- {All button operations pertain to the "current" window.}
-
- {Create a new button}
- procedure NewButton (Button: TP_BNums; {Button number }
- left, top, right, bottom: Integer; {Button's co-ordinates (local) }
- Title: string; {Button's title }
- procID: Integer; {Button's definition ID }
- EnabledFlag, SelectedFlag: boolean); {Enable the button? Select the button? }
-
- {Create a new button (co-ordinates specified as a 'rect') }
- procedure NewButtonRect (Button: TP_BNums; {Button number }
- Bounds: rect; {Button's co-ordinates (local) }
- Title: string; {Button's title }
- procID: Integer; {Button's definition ID }
- EnabledFlag, SelectedFlag: boolean); {Enable the button? Select the button? }
-
- {Delete a button}
- procedure DeleteButton (Button: TP_BNums); {Button number }
-
- {Enable/disable a button}
- procedure EnableButton (Button: TP_BNums; {Button number }
- EnabledFlag: boolean); {Enable the button? }
-
- {Select/deselect a button}
- procedure SelectButton (Button: TP_BNums; {Button number }
- SelectedFlag: boolean); {Select the button? }
-
- {Determine if a button is enabled}
- function ButtonIsEnabled (Button: TP_BNums {Button number }
- ): boolean; {Is the button enabled? }
-
- {Determine if a button is selected}
- function ButtonIsSelected (Button: TP_BNums {Button number }
- ): boolean; {Is the button selected? }
-
- {Set a button's title}
- procedure ButtonTitle (Button: TP_BNums; {Button number }
- Title: string); {Button's title }
-
- {Make a button the window's default button}
- procedure SetDefaultButton (Button: TP_BNums); {Button number }
-
- {Remove the "default button status" from the window's default button}
- procedure NoDefaultButton;
-
- {"Flash" a push button as though it were pressed by the user}
- procedure FlashButton (Button: TP_BNums); {Button number }
-
-
- {===================================== S C R O L L B A R S ====================================== }
- {All scroll bar operations pertain to the "current" window.}
-
- {Create a new scroll bar}
- procedure NewScrollBar (ScrollBar: TP_SNums; {Scroll bar number }
- left, top, right, bottom: Integer; {Scroll bar's co-ordinates (local) }
- EnabledFlag: boolean; {Enable the scroll bar? }
- minimum, value, maximum: integer); {Minimum, current, and maximum value }
-
- {Create a new scroll bar (co-ordinates specified as a 'rect') }
- procedure NewScrollBarRect (ScrollBar: TP_SNums; {Scroll bar number }
- Bounds: rect; {Scroll bar's co-ordinates (local) }
- EnabledFlag: boolean; {Enable the scroll bar? }
- minimum, value, maximum: integer); {Minimum, current, and maximum value }
-
- {Delete a scroll bar}
- procedure DeleteScrollBar (ScrollBar: TP_SNums); {Scroll bar number }
-
- {Enable/disable a scroll bar}
- procedure EnableScrollBar (ScrollBar: TP_SNums; {Scroll bar number }
- EnabledFlag: boolean); {Enable the scroll bar? }
-
- {Get a scroll bar's minimum setting}
- function GetScrollBarMin (ScrollBar: TP_SNums {Scroll bar number }
- ): integer; {Scroll bar's minimum setting }
-
- {Set a scroll bar's minimum setting}
- procedure SetScrollBarMin (ScrollBar: TP_SNums; {Scroll bar number }
- minimum: integer); {Scroll bar's minimum setting }
-
- {Get a scroll bar's maximum setting}
- function GetScrollBarMax (ScrollBar: TP_SNums {Scroll bar number }
- ): integer; {Scroll bar's maximum setting }
-
- {Set a scroll bar's maximum setting}
- procedure SetScrollBarMax (ScrollBar: TP_SNums; {Scroll bar number }
- maximum: integer); {Scroll bar's maximum setting }
-
- {Get a scroll bar's current value}
- function GetScrollBarVal (ScrollBar: TP_SNums {Scroll bar number }
- ): integer; {Scroll bar's current value }
-
- {Set a scroll bar's current value}
- procedure SetScrollBarVal (ScrollBar: TP_SNums; {Scroll bar number }
- value: integer); {Scroll bar's current value }
-
-
- {==================================== E D I T I N G F I E L D S ==================================== }
- {All scroll bar operations pertain to the "current" window.}
-
- {Create a new field}
- procedure NewField (Field: TP_TeNums; {Field number }
- left, top, right, bottom: Integer; {Field's viewing area co-ordinates (local) }
- hStr: Handle; {Handle to edit field's text }
- teType: integer; {Type: box around field and/or CR allowed? }
- Just: integer); {Justification: left, center, right }
-
- {Create a new field (co-ordinates specified as a 'rect') }
- procedure NewFieldRect (Field: TP_TeNums; {Field number }
- Bounds: rect; {Field's viewing area co-ordinates (local) }
- hStr: Handle; {Handle to edit field's text }
- teType: integer; {Type: box around field and/or CR allowed? }
- Just: integer); {Justification: left, center, right }
-
- {Delete a field}
- procedure DeleteField (Field: TP_TeNums); {Field number }
-
- {Activate a field}
- procedure ActivateField (Field: TP_TeNums; {Field number }
- Selection: integer); {Text selection: all, start, end }
-
- {Deactivate the active field}
- procedure DeactivateField;
-
- {Process a mouse click in an inactive field. The click has been detected by the PollSystem procedure.}
- procedure ClickInField;
-
- {Get the active field's edited text}
- procedure GetFieldString (var EditString: str255); {Field's edited text }
-
- {Save the active field's edited text in the field's string}
- procedure SaveFieldString;
-
- {Determine the active field number}
- function ActiveFieldNumber: integer; {Active field number }
-
- {Turn string length limiting on/off for each new field created starting now}
- procedure FieldLengthLimit (Limits: boolean); {Should newly created fields be length-limited? }
-
- {Offset a field}
- procedure OffsetField (Field: TP_TeNums; {Field number }
- dh, dv: integer); {Number of pixels to be offset (horiz/vert) }
-
- {Paste text into a field}
- procedure PasteIntoField (Field: TP_TeNums; {Field number }
- Text: string; {Text which is to be pasted }
- Replace: boolean); {Replace all existing text in field? }
-
-
- {===================================== L I S T B O X E S ======================================= }
- {All list box operations pertain to the "current" window.}
-
- {Create a new List Box}
- procedure NewListBox (ListBox: TP_LNums; {List box number }
- left, top, right, bottom: Integer; {List box co-ordinates (local) }
- BoxType: SignedByte); {Type of responses to mouse clicks, shift-click, }
- { dragging, etc. }
-
- {Create a new List Box (co-ordinates specified as a 'rect') }
- procedure NewListBoxRect (ListBox: TP_LNums; {List box number }
- Bounds: rect; {List box co-ordinates (local) }
- BoxType: SignedByte); {Type of responses to mouse clicks, shift-click, }
- { dragging, etc. }
-
- {Delete a List Box}
- procedure DeleteListBox (ListBox: TP_LNums); {List box number }
-
- {Set a line of text in a List Box}
- procedure SetListBoxText (ListBox: TP_LNums; {List box number }
- LineNum: TP_LnNums; {Line number }
- Text: string); {Text of specified line number }
-
- {Get a line of text from a List Box}
- procedure GetListBoxText (ListBox: TP_LNums; {List box number }
- LineNum: TP_LnNums; {Line number }
- var Text: Str255); {Text of specified line number }
-
- {Get a List Box's line number whose text is greater than or equal to the specified string}
- function SearchListBox (ListBox: TP_LNums; {List box number }
- Text: string {Text being compared }
- ): integer; {Line number of text }
-
- {Select/deselect a specified List Box line}
- procedure SetListBoxLine (ListBox: TP_LNums; {List box number }
- LineNum: TP_LnNums; {Line number }
- setIt: boolean); {Selects the line? }
-
- {Determine if a specific List Box line is selected}
- function GetListBoxLine (ListBox: TP_LNums; {List box number }
- LineNum: TP_LnNums {Line number }
- ): boolean; {Is the line selected? }
-
- {Get the line number of a selected line in a List Box, starting at LineNum and searching down}
- function GetListBoxLines (ListBox: TP_LNums; {List box number }
- LineNum: TP_LnNums {Line number }
- ): integer; {Next selected line }
-
- {Insert a blank line into a List Box}
- procedure InsertListBoxLine (ListBox: TP_LNums; {List box number }
- LineNum: TP_LnNums); {Line number }
-
- {Delete a line from a List Box}
- procedure DeleteListBoxLine (ListBox: TP_LNums; {List box number }
- LineNum: TP_LnNums); {Line number }
-
- {Turn a List Box's text drawing on/off}
- procedure DrawListBox (ListBox: TP_LNums; {List box number }
- drawIt: boolean); {Draw the list box's text? }
-
-
- {========================================= M E N U S ========================================== }
- {Create the "Apple" menu}
- procedure AppleMenu (AboutName: string); {Optional "About…" name }
-
- {Create a menu name, add/change a menu item, or rename an existing menu item}
- procedure Menu (MenuNumber: TP_Mnums; {Menu number }
- ItemNumber: TP_MInums0; {Item number within the menu }
- EnabledFlag: boolean; {Enable the menu? }
- MenuText: string); {Menu title or item name }
-
- {Insert a menu item}
- procedure InsertMenuItem (MenuNumber: TP_Mnums; {Menu number }
- ItemNumber: TP_MInums; {Item number where insertion is to be made }
- EnabledFlag: boolean; {Enable the menu? }
- MenuText: string); {Item name }
-
- {Remove an entire menu and its associated items, or a menu item}
- procedure RemoveMenu (MenuNumber: TP_Mnums; {Menu number }
- ItemNumber: TP_MInums0); {Item number within the menu (0=entire menu) }
-
- {Display the menu bar after making changes through the Menu or RemoveMenu procedure}
- procedure UpdateMenuBar;
-
- {Change the name of a menu item}
- procedure RenameItem (MenuNumber: TP_Mnums; {Menu number }
- ItemNumber: TP_MInums; {Item number within the menu }
- MenuText: string); {Menu title or item name }
-
- {Enable/disable a menu or menu item}
- procedure EnableMenu (MenuNumber: TP_Mnums; {Menu number }
- ItemNumber: TP_MInums0; {Item number within the menu (or 0) }
- EnabledFlag: boolean); {Enable the menu? }
-
- {Display/remove a menu items check mark}
- procedure CheckMenu (MenuNumber: TP_Mnums; {Menu number }
- ItemNumber: TP_MInums; {Item number within the menu }
- checked: boolean); {Place check mark beside the menu item? }
-
- {Mark a menu item with a specified character (√ or •, etc)}
- procedure MenuMark (MenuNumber: TP_Mnums; {Menu number }
- ItemNumber: TP_MInums; {Item number within the menu }
- markChar: char); {Menu item's character }
-
- {Set the character style for a menu item}
- procedure MenuStyle (MenuNumber: TP_Mnums; {Menu number }
- ItemNumber: TP_MInums; {Item number within the menu }
- theStyle: Style); {Menu item's character style }
-
- {Highlight a menu in the menu bar, or turn off menu bar highlights}
- procedure MenuHilite (MenuNumber: TP_Mnums0); {Menu number }
-
-
- {======================================= C U R S O R S ======================================== }
- {Cursor Table and Cursor Zone operations pertain to the "current" window.}
-
- {Change the cursor shape}
- procedure CursorShape (CursorType: integer); {Cursor type }
-
- {Reset the cursor to its appropriate shape depending on its location in the active window.}
- procedure ResetCursor;
-
- {Create a new Cursor Table}
- procedure NewCursorTable (CursorTable: TP_CtNums; {Cursor table number }
- CursorType: integer); {Cursor type }
-
- {Delete a Cursor Table}
- procedure DeleteCursorTable (CursorTable: TP_CtNums); {Cursor table number }
-
- {Add a new Cursor Zone to a Cursor Table, or replace an existing Cursor Zone}
- procedure CursorZone (CursorTable: TP_CtNums; {Cursor table number }
- CursorZone: TP_CzNums; {Cursor zone number }
- CursorType: integer; {Cursor type }
- left, top, right, bottom: Integer); {Cursor zone's co-ordinates (local) }
-
- {Add a new Cursor Zone to a Cursor Table, or replace an existing Cursor Zone (co-ordinates specified as a 'rect') }
- procedure CursorZoneRect (CursorTable: TP_CtNums; {Cursor table number }
- CursorZone: TP_CzNums; {Cursor zone number }
- CursorType: integer; {Cursor type }
- ZoneRect: rect); {Cursor zone's co-ordinates (local) }
-
- {Delete a Cursor Zone}
- procedure DeleteCursorZone (CursorTable: TP_CtNums; {Cursor table number }
- CursorZone: TP_CzNums); {Cursor zone number }
-
- {Get the co-ordinates of a specified Cursor Zone}
- procedure GetCursorZone (CursorTable: TP_CtNums; {Cursor table number }
- CursorZone: TP_CzNums; {Cursor zone number }
- var ZoneRect: rect); {Cursor zone's co-ordinates (local) }
-
- {Make the current window use a specified Cursor Table}
- procedure UseCursorTable (CursorTable: TP_CtNums0); {Cursor table number }
-
- {Find the cursor zone that contains a specified point}
- function FindCursorZone (thePoint: point {Location in window's local co-ordinates }
- ): integer; {Cursor zone number containing the point }
-
- {Enable/disable clicks on push-buttons when the watchCursor is displayed}
- procedure WatchCursorButtons (Allowed: boolean); {Can push-buttons be clicked when the }
- { watchCursor is displayed? }
-
-
- {======================================== P O L L I N G ========================================= }
- {Tools Plus polling procedure}
- function PollSystem (var UserPoll: TPPollRecord {Polling record }
- ): boolean; {Did an event occurred? }
-
- {Determine if your application is 'suspended' (i.e. this is not the active application)}
- function ApplicationSuspended: boolean; {Is your application suspended? }
-
- {Clear the mouse's current click or drag (i.e. discontinue the process, clear the event}
- procedure ResetMouseClicks;
-
-
- {==================================== C O L O R D R A W I N G =================================== }
- {Determine if the Macintosh has Color QuickDraw}
- function HasColorQuickDraw: boolean; {Does the Mac have Color QuickDraw? }
-
- {Determine the number of logical screens (distinct screen depth and color/gray settings)}
- function NumberOfScreens: integer; {Number of logical screens available }
-
- {Begin updating the specified logical screen}
- procedure BeginUpdateScreen (TheScreen: integer); {Logical screen number }
-
- {End updating the most recent logical screen}
- procedure EndUpdateScreen;
-
- {Determine the logical screen's depth}
- function ScreenDepth: integer; {Screen depth in bits }
-
- {Determine if the logical screen is set to display in color }
- function ScreenHasColors: boolean; {Is the screen set to display in color? }
-
- {Color equivalent to 'PenNormal' routine}
- procedure PenColorNormal;
-
- {Color equivalent to 'GetPenState' routine}
- procedure GetColorPenState (var ThePenState: ColorPenState);
-
- {Color equivalent to 'SetPenState' routine}
- procedure SetColorPenState (ThePenState: ColorPenState);
-
-
- {==================================== M I S C E L L A N E O U S =================================== }
- {Determine the System file version}
- function SystemVersion: extended; {System file version (eg: 7.0.1 returned as 7.01)}
-
- {Draw an icon (ICON, ICN#, icl8, icl4, and cicn)}
- procedure DrawIcon (theIcon: integer; {Icon ID number }
- left, top: integer; {Icon's top-left corner in window's local co-ord. }
- EnabledFlag, SelectedFlag: boolean); {Enable the icon? Select the icon? }
-
- {Draw a standard Macintosh progress thermometer}
- procedure DrawThermometer (DisplayRect: rect; {Thermometer's co-ordinates (local) }
- Percent: real); {Percent complete (i.e. .5 means 50%) }
-
- {Perform regular processes such as running desk accessories and Edit Fields (60 times per second) }
- procedure SystemTasks;
-
- {Display a dynamic Alert Box and return the use's action}
- function AlertBox (theIcon: integer; {Icon ID number }
- AlertText: string; {Alert's text }
- AlertCode: longint {Button setup codes }
- ): integer; {Button clicked by user }
-
- {Change a button name for the next use of the dynamic Alert Box}
- procedure AlertButtonName (Button: TP_AltBoxBNums; {Button number from 1 to 9 }
- Title: string); {Button's title }
-
- {Draw "zoom" lines (expanding/collapsing rectangle)}
- procedure ZoomLines (OldRect, {Starting rectangle (global co-ordinates) }
- NewRect: Rect; {Ending rectangle (global co-ordinates) }
- Zoom: integer); {Zoom across, in, or out }
-
- {Wait for a specified duration}
- procedure Wait (ClockTicks: integer); {Number of ticks (1/60th sec) to wait }
-
- {Determine the minimum value of 2 numbers}
- function min (Val1, Val2: longint): longint;
-
- {Determine the maximum value of 2 numbers}
- function max (Val1, Val2: longint): longint;
-
-
-
-
-
- {PRIVATE: This function obtains the System file's version number as an integer for the SystemVersion function. }
- function _SYSV: integer;
-
-
-
- implementation
-
- {The SystemVersion function returns the System File's version as an 'extended' type floating-point number. This }
- {source code, when compiled, will produce an appropriate 'extended' type floating-point number whose format is }
- {determined by your compiler's settings (ie: Compiled for a math co-processor, 68040, or not) }
- function SystemVersion;
- begin
- SystemVersion := _SYSV / 100; {Get System Version and convert to an }
- end; { extended type. }
- end.